
local cmdname = "aids_crush"

if CLIENT then
	
	local args = { { Name = "Car", Value = "models/props_vehicles/car003b_physics.mdl" },
	{ Name = "Big Crate", Value = "models/props/de_nuke/crate_large.mdl" },
	{ Name = "Dumpster", Value = "models/props_junk/TrashDumpster01a.mdl" },
	{ Name = "Couch", Value = "models/props_c17/FurnitureCouch001a.mdl" },
	{ Name = "Cannon Ball", Value = "models/props_phx/cannonball.mdl" },
	{ Name = "Horse Statue", Value = "models/props_c17/statue_horse.mdl" },
	{ Name = "Washing Machine", Value = "models/props_c17/FurnitureWashingmachine001a.mdl" },
	{ Name = "Vending Machine", Value = "models/props_interiors/VendingMachineSoda01a.mdl" },
	{ Name = "Big Fucking Yellow Thing", Value = "models/props/de_nuke/fuel_cask.mdl" } }

	AIDS.RegisterCommand( "Crush", cmdname, "crush", args ) 

else
	
	local function CrushPlayer( ply, cmd, args )
	
		local target = AIDS.GetPlayer( args[1] )
		
		if target then
		
			local mdl = args[2]
		
			target:Freeze( true )
		
			local car = ents.Create( "prop_physics" )
			car:SetModel( mdl )
			car:SetPos( target:GetPos() + Vector( 0, 0, 500 ) )
			car:Spawn()
			
			local phys = car:GetPhysicsObject()
			
			if ValidEntity( phys ) then
			
				phys:SetMass( 9000 )
			
			end
			
			timer.Simple( 5, function( ent, ply ) if ValidEntity( ent ) then ent:Remove() end if ValidEntity( ply ) then ply:Freeze( false ) end end, car, target )
			
			AIDS.ChatPrint( { target, " was crushed to death by ", ply, "." } )
			
		end
	
	end
	
	AIDS.AddCommand( CrushPlayer, cmdname )
	
end